import java.util.Scanner;

/**
 *给出4个1-10的数字，通过加减乘除运算，得到数字为24就算胜利,除法指实数除法运算,运算符仅允许出现在两个数字之间,本题对数字选取顺序无要求，但每个数字仅允许使用一次，且需考虑括号运算
 * 此题允许数字重复，如3 3 4 4为合法输入，此输入一共有两个3，但是每个数字只允许使用一次，则运算过程中两个3都被选取并进行对应的计算操作。
 */
public class TwentyFour {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int[] ints = new int[4];
        while (scanner.hasNext()){
            ints[0] = scanner.nextInt();
            ints[1] = scanner.nextInt();
            ints[2] = scanner.nextInt();
            ints[3] = scanner.nextInt();

            int[] visit = new int[4];
            boolean flag = false;

            for (int i = 0; i < 4; i++) {
                visit[i] = 1;
                if(dfs(ints,visit,ints[i])){
                    flag = true;
                    break;
                }
            }
            System.out.println(flag);
        }
    }

    private static boolean dfs(int[] ints, int[] visit, int anInt) {
        for (int i = 0; i < ints.length; i++) {
            if(visit[i] == 0){
                visit[i] = 1;
                if(dfs(ints,visit,anInt+ints[i]) || dfs(ints,visit,anInt-ints[i])
                || dfs(ints,visit,anInt*ints[i]) || (dfs(ints,visit,anInt/ints[i]) && anInt%ints[i] == 0)){
                    return true;
                }
                visit[i] = 0;
            }
        }
        if(anInt == 24){
            return true;
        }
        return false;
    }
}
